#ifndef _FH_PMU_H_
#define _FH_PMU_H_

#include <linux/types.h>
#include <mach/fh_chipid.h>

#include "chip.h"

struct fh_pm_plat {
	unsigned int rambase;
	unsigned int addr1;
	unsigned int addr2;
	unsigned int addr3;
	void (*suspend_fn)(void);
	void (*resume_fn)(void);
};

struct fh_lp_reg {
	unsigned int addr;
	unsigned int mask;
	unsigned int lpvalue;
	unsigned int savevalue;
};


void fh_get_chipid(unsigned int *plat_id, unsigned int *chip_id);
unsigned int fh_pmu_get_ptsl(void);
unsigned int fh_pmu_get_ptsh(void);
unsigned long long fh_get_pts64(void);
void fh_pmu_wdt_pause(void);
void fh_pmu_wdt_resume(void);
void fh_pmu_usb_utmi_rst(void);
void fh_pmu_usb_phy_rst(void);
void fh_pmu_usb_resume(void);
void fh_pmu_usb_tune(void);
void fh_pmu_usb_vbus_vldext(void);

unsigned int fh_pmu_get_tsensor_init_data(void);
unsigned int fh_pmu_get_ddrsize(void);
void fh_pmu_set_sdc1_funcsel(unsigned int val);

void fh_pmu_sdc_reset(int slot_id);
void fh_pmu_mipi_reset(void);
void fh_pmu_enc_reset(void);
void fh_pmu_dwi2s_set_clk(unsigned int div_i2s, unsigned int div_mclk);
void fh_pmu_restart(void);


void fh_pmu_arxc_write_A625_INT_RAWSTAT(unsigned int val);
unsigned int fh_pmu_arxc_read_ARM_INT_RAWSTAT(void);
void fh_pmu_arxc_write_ARM_INT_RAWSTAT(unsigned int val);
unsigned int fh_pmu_arxc_read_ARM_INT_STAT(void);
void fh_pmu_arxc_reset(unsigned long phy_addr);
void fh_pmu_arxc_kickoff(void);
void fh_pmu_set_hashen(unsigned long en);
void fh_pmu_set_stmautostopgpio(int stmid, int gpio);

int fh_pmu_init(void);

void fh_pmu_set_reg(unsigned int offset, unsigned int data);
unsigned int fh_pmu_get_reg(unsigned int offset);
void fh_pmu_set_reg_m(unsigned int offset,
unsigned int data, unsigned int mask);
void _pmu_ahb_reset(unsigned int reg, unsigned int retry, unsigned int udelay);

/* for fh889x/fh8210 */
void fh_pmu_perfmon_init(int timelow, int timehigh);
void fh_pmu_perfmon_timer_cnt_clr(void);
void fh_pmu_perfmon_rd_trigger(void);
void fh_pmu_set_mclk(int freq);
void fh_pmu_reset_i2s(void);
void fh_pmu_set_emmc_clock(unsigned int clock);
void fh_pmu_emmc_reset(void);
void fh_pmu_set_emmc_sample_delay0(unsigned int val);
void fh_pmu_set_emmc_sample_delay1(unsigned int val);
void fh_pmu_reset_rsa(void);
void fh_pmu_set_dma_sel_low(unsigned int val);
void fh_pmu_set_dma_sel_high(unsigned int val);
void fh_pmu_set_dma0_axcache(unsigned int val);
void fh_pmu_set_dma1_axcache(unsigned int val);
void fh_pmu_spi_slave_enable(unsigned int enable);
void fh_pmu_usb_axi_clk_en(unsigned int is_u3, unsigned int enable);
void fh_pmu_usb_utmi_rst(void);
void fh_pmu_usb_phy_rst(void);
void fh_pmu_usb_resume(void);
void fh_pmu_usb_tune(void);
void fh_pmu_usb_vbus_vldext(void);
void mol_pmu_set_efuse_lock_blk(unsigned int val);
int fh_pmu_eth_set_speed(unsigned int speed);
void fh_pmu_eth_reset(void);
int fh_pmu_ephy_sel(__u32 phy_sel);
void fh_pmu_internal_ephy_reset(void);

#endif /* _FH_PMU_H_ */
